# -*- coding: utf-8 -*- 
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/8/6
# @File : （step5）C. K-th Sum （CF）.py
# https://codeforces.com/edu/course/2/lesson/6/5/practice/contest/285084/problem/C

def bi_common(n,x):#从1开始
    l = 0
    r = n+1
    while(l+1<r):
        mid = (l+r)//2
        if(arr2[mid]<=x-1):#从1开始的一般这样就可以把等号写在这里，就是写x-1，而不是x，这样就可以统一返回l
            l = mid
        else:
            r = mid
    return l
def check(n,mid):
    cnt = 0
    for i in arr1:
        cnt += bi_common(n,mid-i)
    return cnt
def bi(n,k):
    l = 0
    r = 2*10**9 +1
    while(l+1<r):
        mid = (l+r)//2
        if(check(n,mid)<=k-1):
            l = mid
        else:
            r = mid
    return l
if __name__ == "__main__":
    n,k = map(int ,input().split())
    arr1 = [int(i) for i in input().split()]
    arr2 = [int(i) for i in input().split()]
    arr1.sort()
    arr2.sort()
    res = bi(n,k)
    print(res)
"""
O(n*logn*logn),check为n*logn。
bi_common函数也是为了计算出有多少个小于当前的和的，也是包括这个和
也是从1开始的k-th,跟B题是一样的。
"""